home *** CD-ROM | disk | FTP | other *** search
/ Champak 33 / Volume 33 - JOGO DISK .iso / Games / space_runner_2.swf / scripts / frame_86 / PlaceObject2_64_366 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Text File  |  2007-01-12  |  2KB  |  95 lines

  1. onClipEvent(enterFrame){
  2.    if(this.hitTest(_root.left))
  3.    {
  4.       this._x = _root.left._x + 15;
  5.    }
  6.    if(this.hitTest(_root.right))
  7.    {
  8.       this._x = _root.right._x - 15;
  9.    }
  10.    i = 1;
  11.    while(5 >= i)
  12.    {
  13.       if(this.hitTest(_root["die" + i].h) and die == 0)
  14.       {
  15.          this.gotoAndPlay("die");
  16.       }
  17.       i++;
  18.    }
  19.    i = 1;
  20.    while(13 >= i)
  21.    {
  22.       if(this.hitTest(_root["pris" + i]) and die == 0)
  23.       {
  24.          _root["pris" + i].play();
  25.       }
  26.       i++;
  27.    }
  28.    if(die == 0)
  29.    {
  30.       this.stilla._visible = true;
  31.       this.springa._visible = false;
  32.       this.hoppa._visible = false;
  33.       this.springa.stop();
  34.       if(gravity == "on")
  35.       {
  36.          this._y += 10;
  37.       }
  38.       if(Key.isDown(39))
  39.       {
  40.          skala = 1;
  41.          this._xscale = 100 * skala;
  42.          this._x += 7;
  43.          this.stilla._visible = false;
  44.          this.springa._visible = true;
  45.          this.springa.play();
  46.       }
  47.       if(Key.isDown(37))
  48.       {
  49.          skala = -1;
  50.          this._xscale = 100 * skala;
  51.          this._x -= 7;
  52.          this.stilla._visible = false;
  53.          this.springa._visible = true;
  54.          this.springa.play();
  55.       }
  56.       if(Key.isDown(38) && !jumping and this.hoppa._visible == false and testahopp == 0)
  57.       {
  58.          platform = "no";
  59.          vel_y = 23;
  60.          jumping = true;
  61.          this.stilla._visible = false;
  62.          this.springa._visible = false;
  63.          this.hoppa._visible = true;
  64.          this.springa.stop();
  65.          testahopp = 1;
  66.       }
  67.       if(jumping == true)
  68.       {
  69.          if(platform == "on")
  70.          {
  71.             gravity = "on";
  72.             vel_y = 0;
  73.             jumping = false;
  74.          }
  75.          else
  76.          {
  77.             gravity = "off";
  78.             this.stilla._visible = false;
  79.             this.springa._visible = false;
  80.             this.hoppa._visible = true;
  81.          }
  82.          vel_y -= accel;
  83.          if(vel_y < -10)
  84.          {
  85.             vel_y = -10;
  86.          }
  87.          this._y -= vel_y;
  88.       }
  89.       if(Key.isDown(38) == false)
  90.       {
  91.          testahopp = 0;
  92.       }
  93.    }
  94. }
  95.